package com.icloud.article.boot.controller.app;

import com.icloud.article.boot.dto.ArticleBrowsedBatchDelDto;
import com.icloud.article.boot.dto.ArticleBrowsedPageDto;
import com.icloud.article.boot.service.ArticleBrowsedService;
import com.icloud.article.boot.service.ArticleService;
import com.icloud.article.boot.vo.ArticleBrowsedPageVo;
import com.icloud.common.core.api.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "App帖子浏览接口")
@RequestMapping("/app/browsed")
@RequiredArgsConstructor
public class AppArticleBrowsedController {
    private final ArticleBrowsedService articleBrowsedService;
    private final ArticleService articleService;

    @ApiOperation("批量删除")
    @PostMapping("/batchDel")
    public CommonResult<Boolean> batchDel(@Validated @RequestBody ArticleBrowsedBatchDelDto dto){
        return CommonResult.success(articleBrowsedService.batchDel(dto));
    }

    @ApiOperation("分页查询")
    @PostMapping("/page")
    public CommonResult<ArticleBrowsedPageVo> browsedPage(@Validated @RequestBody ArticleBrowsedPageDto dto){
        return CommonResult.success(articleService.browsedPage(dto));
    }
}
